(function($) {
	$.fn.lrkf = function(options) {
		var opts = {
			position : "fixed",
			btntext : "\u5ba2\u670d\u5728\u7ebf",
			qqs : null,
			qqs4qy : null,
			ww : null,
			tel : null,
			more : null,
			kftop : "120",
			z : "99999",
			defshow : true,
			Event : "",
			callback : function() {
			}
		}, $body = $("body"), $url = "";
		$.extend(opts, options);
		if (!$("#lrkfwarp").length > 0) {
			$body
					.append("<div id='lrkfwarp' class='lrkf lrkfshow' style="
							+ opts.position
							+ "><a href='#' class='lrkf_btn lrkf_btn_hide' id='lrkf_btn' onfocus='this.blur()'>"
							+ opts.btntext
							+ "</a><div class='lrkf_box'><div class='lrkf_header'><a href='#' title='\u5173\u95ed' class='x' id='lrkf_x'></a></div><div class='lrkf_con' id='lrkf_con'><ul class='kflist'></ul></div><div class='lrkf_foot'></div></div></div><style>html{overflow-x:hidden;}#lrkfwarp ul{padding-left:0; margin:0;list-style-type: none;}.lrkf{font-size:13px;position:fixed;}.lrkf a{ display:block; color:#666; text-decoration:none; font-size:13px;}#lrkfwarp img{ border:none;vertical-align:middle; margin-right:4px; margin-top:-2px;display:inline;}.lrkf_con{padding:6px 8px;}.lrkf_con li.qq{padding:5px 0;text-align: center;}.lrkf_con li.tel{ line-height:1.35; padding-bottom:4px;text-align: center;}.lrkf_con li.more{ padding:2px 0;}.lrkf_con li.tel b{ display:block; color:#C00;}.lrkf_tool a{ display:block; padding:8px 10px; text-align:center;}.lrkf_con .hr{padding:0;height:0;font-size:0;line-height:0;clear:both;margin:4px 0;border-bottom:#fff solid 1px;border-top:#CFCFCF solid 1px;border-left:none;border-right:none;}.lrkf_btn{position:absolute; top:20px;width:22px;left:-22px;display:block;text-align:center;padding:10px 0;}.lrkf .lrkf_xc{ position:absolute; bottom:-14px; right:6px;font-size:10px;display:none;}</style>")
		}
		var $lrkfwarp = $("#lrkfwarp"), $lrkf_con = $("#lrkf_con"), $kflist = $lrkf_con
				.children("ul"), $lrkf_x = $("#lrkf_x"), $lrkf_btn = $("#lrkf_btn"), $lrkfwarp_w = $lrkfwarp
				.outerWidth() * 1 + 1;
		$lrkfwarp.css({
			top : opts.kftop + "px",
			"z-index" : opts.z
		});
		if (!opts.defshow) {
			$lrkfwarp.removeClass("lrkfshow").css({
				right : -$lrkfwarp_w
			})
		}
		if (opts.qqs) {
			var json = {
				options : opts.qqs
			};
			json = eval(json.options);
			$.each(json,function(i, o) {
				var headChar = o.qq.substr(0, 3);
				if((headChar == "400" || headChar == "400") && o.qq.length >= 9){	//企业QQ号码
					$kflist.append("<li class='qq'><img style=\"CURSOR: pointer\" onclick=\"javascript:window.open('http://b.qq.com/webc.htm?new=0&sid="+o.qq+"&eid=218808P8z8p8x8P8z8p8q&o=&q=7&ref='+document.location, '_blank', 'height=544, width=644,toolbar=no,scrollbars=no,menubar=no,status=no');\"  border=\"0\" SRC=\"http://im.bizapp.qq.com:8000/zx_qq.gif\"><br/><span style=\"CURSOR: pointer\" onclick=\"javascript:window.open('http://b.qq.com/webc.htm?new=0&sid="+o.qq+"&eid=218808P8z8p8x8P8z8p8q&o=&q=7&ref='+document.location, '_blank', 'height=544, width=644,toolbar=no,scrollbars=no,menubar=no,status=no');\">"+o.name+"</span></li>");
				}else{	//普通QQ号码
					$kflist.append('<li class="qq"><a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin='+o.qq+'&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:'+o.qq+':41" /><br/>'+o.name+'</a></li>');
				}
			});
		}
		if (opts.ww) {
			$kflist.append("<li class=hr></li>");
			var json_ww = {
				options : opts.ww
			};
			json_ww = eval(json_ww.options);
			$.each(json_ww, function(i, o) {
				$kflist.append("<li class=qq><a target=_blank href=http://www.taobao.com/webww/ww.php?ver=3&touid="+o.ww+"&siteid=cntaobao&status=1&charset=utf-8><img src=http://amos.alicdn.com/realonline.aw?v=2&uid="+o.ww+"&site=cntaobao&s=1&charset=utf-8><br/>"+o.name+"</a></li>")
			})
		}
		if (opts.tel) {
			$kflist.append("<li class=hr></li>");
			var json_tel = {
				options : opts.tel
			};
			json_tel = eval(json_tel.options);
			$.each(json_tel, function(i, o) {
				$kflist.append("<li class=tel>" + o.name + ":<b>" + o.tel
						+ "</b></li>")
			})
		}
		if (opts.more) {
			$kflist.append("<li class=hr></li><li class=more><a href='"+ opts.more + "'>>>\u66f4\u591a\u65b9\u5f0f</a></li>")
		}
		var $lrkfwarptop = $lrkfwarp.offset().top;
		if ($.browser.msie && $.browser.version == 6
				|| opts.position == "absolute") {
			$(window).scroll(function() {
				var offsetTop = $lrkfwarptop + $(window).scrollTop() + "px";
				$lrkfwarp.animate({
					top : offsetTop
				}, {
					duration : 600,
					queue : false
				})
			})
		}
		$lrkf_x.click(function() {
			$lrkfwarp.hide();
			return false
		});
		if (opts.Event == "") {
			$lrkfwarp.mouseenter(function() {
				$(this).stop().animate({
					right : 0
				})
			}).mouseleave(function() {
				$(this).stop().animate({
					right : -$lrkfwarp_w
				})
			})
		} else {
			$lrkf_btn.on("click", function() {
				if ($lrkfwarp.hasClass("lrkfshow")) {
					$lrkfwarp.animate({
						right : -$lrkfwarp_w
					}, function() {
						$lrkfwarp.removeClass("lrkfshow")
					})
				} else {
					$lrkfwarp.addClass("lrkfshow").animate({
						right : 0
					})
				}
				return false
			})
		}
	}
})(jQuery);